public class code1 {

    public static String con(int x,int n) {
        StringBuilder str1 = new StringBuilder();
        while(x>0) {//8:0001
            str1.append(x%n);
            x/=n;
        }
        return str1.reverse().toString();//翻转并变为String
    }

    public static void main(String[] args) {
        String str = "2021ABCD";
        long sum = 0;
        int k =0;
        for(int i=str.length()-1;i>=0;i--) {
            char ch = str.charAt(i);
            if(ch>='A'&& ch<='D') {
                int ret = ch-'A'+10;
                sum+=(long)ret*Math.pow(16, k);
            } else {
                int ret = ch-'0';//字符数字转为数字
                sum+=(long)ret*Math.pow(16, k);
            }
            k++;
        }
        System.out.print(sum);
    }

    public static void main2(String[] args) {
        int sum=0,num=0;
        for(int i=0; ;i++) {
            sum += Math.pow(2, i);
            num++;
            if(sum>10000) {
                break;
            }
        }
        System.out.print(num);
    }
}
